#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <assert.h>
#include <sys/types.h>
#include <sys/wait.h>
#define LEFT "["
#define RIGHT "]"
#define DOS "$"

#define LEN 32

int main()
{
    char arr[LEN] = {0};
    char* buf[LEN] = {0};
    while(1)
    {
        printf(LEFT"%s@%s %s"RIGHT DOS,getenv("USER"),getenv("HOSTNAME"),getenv("PWD"));
        char* s = fgets(arr,sizeof(arr),stdin);
        assert(s);
        (void*)s;
        arr[strlen(arr) - 1] = '\0';
       //printf("%s",arr);
        int i = 1;
        buf[0] = strtok(arr," ");
        while(buf[i++] = strtok(NULL," "));

        pid_t id = frok();
        if(id == 0)
        {
            execv(buf[0],buf);
        }

        int status = 0;
       pid_t t =  waitpid(id,&status,0);



    }
    return 0;
}
